<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${key.charge_adjust_title}</title>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">
var totalAmt = 0.00;
function ajaxSubmit(){
	var isTrue=$('derateForm').fireEvent("onSubmit");
    if(isTrue){
        var url = "${ctx}/charge_cashieringAction.do?method=addLateFeeDerateByGross";
        var param = Form.serialize('derateForm');
        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResponse});
	}
}
function showResponse(response){
	if(response.responseText == "true" ){
	    var obj = findFrame("lateFeeListFrame");
	    windowClose();
	    obj.parent.refresh(document.getElementById("curReliefAmt").value);
	    obj.parent.reSetBalanceAndLateFee(${balance}-document.getElementById("curReliefAmt").value,totalAmt);
    }
    else
       ajaxSubmitException(response.responseText);
}
function calculate(thiz){
		if(thiz.value.length>0 && isNaN(thiz.value) == false)
		{
			var result = parseFloat(${batch.totalAmt})-parseFloat(thiz.value);
			if(result >=0 && result>=parseFloat(${batch.outLockAmt})){
				totalAmt = ForDight(result,2)
				document.getElementById('leftTotalAmtId').innerHTML=ForDight(result,2)+"元";
				document.getElementById("latefeetip").innerHTML ="";
			}else{
				thiz.value="";
				var temp = ForDight(${batch.totalAmt}-${batch.outLockAmt},2)
				document.getElementById("latefeetip").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(其中:出盘锁定"+${batch.outLockAmt}+"元,可减免"+temp+"元)"
			}
		}
}
function   ForDight(Dight,How)
{
     Dight = Math.round(Dight*Math.pow(10,How))/Math.pow(10,How);
     return Dight;
}
</script>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">按滞纳金总额减免</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td border="0" cellspacing="0" cellpadding="0" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
        <form name="derateForm" method="post" action="${ctx}/charge_cashieringAction.do?method=addLateFeeDerateByGross" class="required-validate">
        <input type="hidden" name="outLockAmt" value="${batch.outLockAmt}">
        <input type="hidden" name="totalAmt" value="${batch.totalAmt}">
        <input type="hidden" name="accountId" value="${batch.accountId}">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
            <tr>
              <td class="aux_intable_td1" style="width:'30%';">滞纳金合计：</td>
              <td class="aux_intable_td2" style="width:'70%';"><fmt:formatNumber pattern="###,##0.00" value="${batch.totalAmt}"/>元 <span id="latefeetip" style="text-align: right;"></span></td>
              </tr>
            <tr>
              <td class="aux_intable_td1" >本次减免滞金：</td>
              <td class="aux_intable_require" ><input name="curReliefAmt" type="text" maxlength="18" class="required float-un-zero integer-decimal-range-18-2" size="16" style="text-align:right"  value="" onblur="calculate(this);" afterInsert="tip">元 <span id="tip"></span></td>
            <tr>
              <td class="aux_intable_td1" >滞纳金余额：</td>
              <td class="aux_intable_td2" id="leftTotalAmtId" ><fmt:formatNumber pattern="###,##0.00" value="${batch.totalAmt}"/>元</td>
             </tr>
            <tr>
              <td valign="top" class="aux_intable_td1" >交易摘要：</td>
              <td valign="top" class="aux_intable_require_more" ><textarea name="transDescription" class="required max-length-350" cols="25" rows="4"></textarea></td>
            </tr>
        </table>
        </form>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
  
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0" onclick="ajaxSubmit()">
            <tr>
              <td class="buttonOffLeft" id="btn1_61"></td>
              <td class="buttonOffMiddle" id="btn1_62"  onMouseOver="btn_change_over(6)" onMouseOut="btn_change_out(6)" onBlur="btn_change(6)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">保 存</td>
              <td class="buttonOffRight" id="btn1_63"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_71"></td>
              <td class="buttonOffMiddle" id="btn1_72" onClick="windowClose();" onMouseOver="btn_change_over(7)" onMouseOut="btn_change_out(7)" onBlur="btn_change(7)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom">关 闭</td>
              <td class="buttonOffRight" id="btn1_73"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
</body>
</html>